package com.bookyourtrek.model;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.bookyourtrek.util.DbConnection;

public class HomeModel {

	private PreparedStatement ps = null;
	private ResultSet rs = null;
	private String sqlQuery = "";
	private Connection conn = null;
	
	/**
	 * function to get the list of companies
	 * @author ananda
	 * @return
	 */
	public List<String> getcountrylist() {
		List<String> countrylist = new ArrayList<String>();;
		sqlQuery = "SELECT locationname FROM bookyourtrek.location;";
		conn = DbConnection.getConnection();
		try {
			ps = conn.prepareStatement(sqlQuery);
			rs = ps.executeQuery();
			while (rs.next()) {
				countrylist.add(rs.getString(1));
			}
	}catch (SQLException e) {
		e.printStackTrace();
	}finally {
		
	}
		
		return countrylist;
}
}
